# -*- coding: utf-8 -*-
__author__ = 'Paul'
from plone.memoize.instance import memoize
# Import default Plone viewlet classes
from plone.app.layout.viewlets              import common as base
from Acquisition import aq_parent, aq_inner

class PieBpContents(base.ViewletBase):
    """Un slot para lanzar los metodos javascript al final del vody"""

    @memoize
    def chkViable(self):
        """Verifica que esté en un articulo, galeria, libro, o evento,"""
        contexto=aq_inner(self.context)
        if contexto.portal_type in ("Products.bpContents.articulo","Products.bpContents.galeria","Products.bpContents.aviso","Products.bpContents.evento"):
            return True
        else:
            return None

    def getURL(self):
        return self.context.absolute_url()

    def update(self):
        pass__author__ = 'Paul'
